<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 头部操作栏 -->
            <div class="layui-form lay-header">
                <div class="toolbar">
                    <div class="layui-form-item lay-query-content">
                        <div class="lay-query-box">
                            <div class="query-lt">
                                <div class="layui-inline">
                                    <label class="layui-form-label">创建时间:</label>
                                    <div class="layui-input-inline" style="width: 290px">
                                        <input name="createTime" id="pTime" class="layui-input" type="text"
                                               placeholder="选择时间" autocomplete="off" readonly/>
                                    </div>
                                    <input name="startTime" id="startTime" type="hidden"/>
                                    <input name="endTime" id="endTime" type="hidden"/>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">订单编号:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="code" placeholder="订单编号" autocomplete="off"/>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">物料编号:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="skuCode" placeholder="物料编号" autocomplete="off"/>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">使用台机:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="deviceCode" placeholder="使用台机" autocomplete="off"/>
                                    </div>
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label">部门：</label>
                                    <div class="layui-input-inline">
                                        <select name="departmentId" lay-filter="departmentId" lay-search="" class="common-select-search"></select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">操作人：</label>
                                    <div class="layui-input-inline">
                                        <select name="creatorId" lay-search="" class="common-select-search"></select>
                                    </div>
                                </div>
                            </div>
                            <div class="query-rt">
                                <div class="layui-inline">
                                    <button lay-filter="formSubSearchLog" class="layui-btn icon-btn color-green" lay-submit
                                       type="button" layui-form-keyDownSearch="true">查询
                                    </button>
                                    <button class="layui-btn icon-btn color-white" lay-filter="resets" type="button"
                                            lay-submit>重置
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="lay-btn-rows">
                    <div class="lay-btn-box">
                        <div class="lay-btn-lt">
                            <button id="orderLoadBtnExport" type="button" class="layui-btn icon-btn color-green">导出</button>
                        </div>
                        <div class="lay-btn-rt">

                        </div>
                    </div>
                </div>
            </div>
            <!-- 表格 -->
            <table class="layui-table" id="oldNewOrderTable" lay-filter="oldNewOrderTable"></table>
        </div>
    </div>
</div>

<!-- 表格操作列 -->
<script type="text/html" id="oldNewOrderTableBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="oldNewDetail">详情</a>
</script>

<!-- 表单弹窗 -->
<script type="text/html" id="oldNewOrderForm">
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <!-- 表格 -->
                <table class="layui-table" id="orderDetailTable" lay-filter="orderDetailTable"></table>

                <!-- 三个订单详情 -->
                <div class="layui-tab" id="threeOrderDetail">
                    <ul class="layui-tab-title">
                        <li class="layui-this" data-id="oldLeadNew">旧领用订单信息</li>
                        <li data-id="storage">暂存存入订单信息</li>
                        <li data-id="newLeadNew">领新订单信息</li>
                    </ul>
                    <div class="layui-tab-content">
                        <!-- 旧领用订单信息 -->
                        <div class="layui-tab-item layui-show">
                            <!--<table class="layui-table" id="oldLeadNewDetailTable" lay-filter="oldLeadNewDetailTable"></table>-->
                            <div class="layui-col-md4">
                                <div class="capitalBoxList">
                                    <form class="layui-form model-form" lay-filter="oldLeadNewDetailTable"
                                          style="padding: 0">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">旧订单类型</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="" class="layui-input" value="领新订单" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">旧订单编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="code" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">设备机台编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="deviceName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属加工单</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领取人</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="creatorName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领取时间</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="createTime" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属主柜</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="cabCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">出货货道/货位</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="spaceCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料型号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="productTypeName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属品牌</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="productBrandName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料名称</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">规格码</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuSpec" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领用数量</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="quantity" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">描述</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="remark" class="layui-input" disabled>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <!-- 暂存存入订单信息 -->
                        <div class="layui-tab-item">
                            <!--<table class="layui-table" id="storageDetailTable" lay-filter="storageDetailTable"></table>-->
                            <div class="layui-col-md4">
                                <div class="capitalBoxList">
                                    <form class="layui-form model-form" lay-filter="storageDetailTable"
                                          style="padding: 0">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">暂存订单编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="code" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">归还机台编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="deviceName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属加工单</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">归还人</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="creatorName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">存入时间</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="createTime" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">存入方式</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="businessTypeDesc" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属主柜</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="cabCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">存入货位</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="spaceCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">货位性质</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="spaceTypeDesc" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">商品型号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="productTypeName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属品牌</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="productBrandName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料名称</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">商品规格码</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuSpec" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">归还数量</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="quantity" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">旧订单备注</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="remark" class="layui-input" disabled>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <!-- 领新订单信息 -->
                        <div class="layui-tab-item">
                            <!--  <table class="layui-table" id="newLeadNewDetailTable" lay-filter="newLeadNewDetailTable"></table>-->
                            <div class="layui-col-md4">
                                <div class="capitalBoxList">
                                    <form class="layui-form model-form" lay-filter="newLeadNewDetailTable"
                                          style="padding: 0">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领新订单编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="code" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">使用机台编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="deviceName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属加工单</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领用人(以旧换新操作人)</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="creatorName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领新时间</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="createTime" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属主柜</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="cabCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">出货货道/货位</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="spaceCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">商品型号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="productTypeName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuCode" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">所属品牌</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="productBrandName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">物料名称</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuName" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">商品规格码</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="skuSpec" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">领取数量</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="quantity" class="layui-input" disabled>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">备注</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="remark" class="layui-input" disabled>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</script>

<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'admin','laydate'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var admin = layui.admin;
        var upload = layui.upload;
        var laydate = layui.laydate;

        form.render('select');
        admin.selectSearch();

        //时间范围
        laydate.render({
            elem: '#pTime',
            type: 'datetime',
            range: true,
            done: function (value, date, endDate) {
                /*if(value){
                    let dateValue = value.split(" - ");
                    $("#startTime").val(dateValue[0]+" 00:00:00");
                    $("#endTime").val(dateValue[1]+" 23:59:59");
                }else {
                    $("#startTime").val("");
                    $("#endTime").val("");
                }

                setTimeout(function() {$('[lay-filter="formSubSearchLog"]').click()}, 300);*/
                if (value) {
                    let dateValue = value.split(" - ");
                    let startTime = dateValue[0];
                    let endTime = dateValue[1];
                    // 检查用户是否选择了时分秒
                    if (!/\d{2}:\d{2}:\d{2}$/.test(startTime)) {
                        startTime += " 00:00:00"; // 默认时分秒为00:00:00
                    }

                    $("#startTime").val(startTime);
                    $("#endTime").val(validateAndReplaceTime(endTime));
                } else {
                    $("#startTime").val("");
                    $("#endTime").val("");
                }
                setTimeout(function() {
                    $('#pTime').val( $("#startTime").val()+' - '+$("#endTime").val());
                    $('[lay-filter="formSubSearchLog"]').click();
                }, 300);
            }
        });

        function validateAndReplaceTime(time) {
            // 定义正则表达式，匹配形如 'YYYY-MM-DD 00:00:00' 的时间格式
            let regex = /^(\d{4}-\d{2}-\d{2}) 00:00:00$/;

            // 验证时间格式是否符合要求
            if (regex.test(time)) {
                // 如果时间格式符合要求，则替换时分秒为 '23:59:59'
                return time.replace(/00:00:00$/, '23:59:59');
            } else {
                // 如果时间格式不符合要求，则返回 false
                return time;
            }
        }

        // 渲染表格
        var insTb = table.render({
            elem: '#oldNewOrderTable',
            url: config.base + 'enterprisecab/order/admin/oldNewOrder/list',
            toolbar: true,
            defaultToolbar: ["filter"],
            page: true,
            cellMinWidth: 100,
            cols: [[
                {type: 'numbers', title: '序号', fixed: 'left'}
                // , {field: 'oldLeadNewCab',  title: '所属柜子', fixed: 'left'}
                , {field: 'skuName', title: '物料名称', fixed: 'left', width: 160}
                , {field: 'skuCode', title: '物料编号', fixed: 'left', width: 160}
                , {field: 'skuSpecOld', title: '规格码', fixed: 'left', width: 160}
                , {field: 'productBrandName', title: '品牌'}
                ,{field: 'deviceCode', title: '机台'}
                ,{field: 'code', sort: true, title: '订单编号', width: 180}
                , {field: 'costCenter',  title: '成本中心'}
                , {field: 'departmentName',  title: '部门'}
                , {field: 'storageSeat',  title: '旧刀存入货位',  width: 150}
                , {field: 'storageCode',  title: '旧刀存入订单',  width: 150}
                , {field: 'storageBusinessTypeDesc',  title: '存入方式'}
                , {field: 'newLeadNewSpaceCode',  title: '领新出货货道', width: 130}
                , {field: 'newLeadNewCode',  title: '领新订单编号', width: 160}
                //, {field: 'newLeadNewStatus',  title: '领新状态'}
                , {field: 'creatorName', title: '创建人', width: 160}
                , {field: 'createTime', title: '创建时间', width: 160}
                // , {align: 'center', toolbar: '#oldNewOrderTableBar', title: '操作', width: 200, fixed: 'right'}
            ]],

        });
        // 重置搜索
        form.on('submit(resets)', function (data) {
            $(".lay-header").find('select').val("");
            $(".lay-header").find('input').val("");
            var field = data.field;
            for(let key in field){
                field[key] = ''
            }
            insTb.reload({where: field,page: {curr: 1}},'data');
            loadReportSelectHtml([],'请选操作人','creatorId',2,'.lay-header');
        });

        // 工具条点击事件
        table.on('tool(oldNewOrderTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'oldNewDetail') { //详情
                showOldNewDetail(data);
            }
        });

        // 部门
        admin.req('user/admin/department/list', {limit:9999}, res => {
            if (res.code == 200){
                loadReportSelectHtml(res.data,'请选择部门','departmentId',1,'.lay-header')
            }else {
                loadReportSelectHtml([],'请选择部门','departmentId',1,'.lay-header')
            }
        });

        //部门操作
        form.on('select(departmentId)',function(data){
            selectManager(data.value);
        });

        // 操作人
        function selectManager(_data) {
            if (_data){
                admin.req('user/admin/user/list', {limit:9999, departmentId:_data}, res => {
                    if (res.code == 200){
                        loadReportSelectHtml(res.data,'请选操作人','creatorId',2,'.lay-header')
                    }else {
                        loadReportSelectHtml([],'请选操作人','creatorId',2,'.lay-header')
                    }
                });
            }else {
                loadReportSelectHtml([],'请选操作人','creatorId',2,'.lay-header')
            }
        }

        function showOldNewDetail(data) {
            admin.open({
                type: 1,
                area: ['1500px', '700px'],
                offset: '65px',
                title: '订单详情',
                content: $('#oldNewOrderForm').html(),
                success: function () {
                    form.render('select');
                    var insTb3 = table.render({
                        elem: '#orderDetailTable',
                        url: config.base + "enterprisecab/order/admin/oldNewOrder/list?id=" + data.id,
                        page: true,
                        cellMinWidth: 115,
                        cols: [[
                            {field: 'code', sort: true, title: '订单编号'}
                            , {field: 'oldLeadNewCab',  title: '所属柜子'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'oldLeadNewCode',  title: '旧订单编号'}
                            , {field: 'deviceCode', sort: true, title: '机台'}
                            , {field: 'storageSeat',  title: '旧刀存入货位'}
                            , {field: 'storageCode',  title: '旧刀存入订单'}
                            , {field: 'storageStatus',  title: '存入状态'}
                            , {field: 'newLeadNewSpaceCode',  title: '领新出货货道'}
                            , {field: 'newLeadNewCode',  title: '领新订单编号'}
                            , {field: 'newLeadNewStatus',  title: '领新状态'}
                            , {field: 'createTime', sort: true, title: '创建时间'}
                        ]]
                    });


                    /*旧订单*/
                    admin.req('enterprisecab/order/admin/oldNewOrder/oldLeadNewList', {'id': data.oldCellInventoryInoutId,skuCode:data.skuCode}, (res) => {
                        if (res.code === 200) {
                            res.data.quantity=Math.abs(res.data.quantity);
                            form.val('oldLeadNewDetailTable', res.data);
                        }
                    }, 'GET');


                    $("#threeOrderDetail").find("ul li").each(function (index, item) {
                        $(item).click(function () {
                            if ($(this).data("id") === "oldLeadNew") {
                                admin.req('enterprisecab/order/admin/oldNewOrder/oldLeadNewList', {'id': data.oldCellInventoryInoutId,skuCode:data.skuCode}, (res) => {
                                    if (res.code == '200') {
                                        res.data.quantity=Math.abs(res.data.quantity);
                                        form.val('oldLeadNewDetailTable', res.data);
                                    }
                                }, 'GET');
                            } else if ($(this).data("id") === "storage") {
                                admin.req('enterprisecab/order/admin/oldNewOrder/storageList', {'id': data.storageInventoryInoutId,skuCode:data.skuCode}, (res) => {
                                    if (res.code == '200') {
                                        form.val('storageDetailTable', res.data);
                                    }
                                }, 'GET');
                            } else {//newLeadNew
                                admin.req('enterprisecab/order/admin/oldNewOrder/newLeadNewList', {'id': data.newCellInventoryInoutId,skuCode:data.skuCode}, (res) => {
                                    if (res.code == '200') {
                                        res.data.quantity=Math.abs(res.data.quantity);
                                        form.val('newLeadNewDetailTable', res.data);
                                    }
                                }, 'GET');
                            }
                        })
                    })
                }
            });
        }



        //监听排序
        table.on('sort(oldNewOrderTable)', function (obj) {
            table.reload('oldNewOrderTable', {
                initSort: obj
                , where: {
                    sort: obj.field
                    , order: obj.type
                }
            });
        });

        // 搜索
        form.on('submit(formSubSearchLog)', function (data) {
            insTb.reload({where: data.field, page: {curr: 1}}, 'data');
        });
        // 导出上货记录
        $('#orderLoadBtnExport').click(function () {
            var sTime = $('#startTime').val();
            var eTime = $('#endTime').val();

            if (sTime == "" && eTime == ""){
                layer.msg('请先选择创建时间！')
            } else {

                location.href = config.base + 'enterprisecab/order/admin/oldNewOrder/export?startCreateTime='+sTime+'&endCreateTime='+eTime+ '&enterpriseCode=' + config.getUser().enterpriseCode;
            }
        });

        // 渲染下拉框
        function loadReportSelectHtml(data, tips, htmltarget, type, parentName) {
            let html = ' <option value="">' + tips + '</option>';
            if (!data || data == null) {
                return;
            }
            for (let i = 0; i < data.length; i++) {
                if (type == 1) {
                    html += `<option value='${data[i].id}'>${data[i].name}</option>`;
                } else if (type == 2) {
                    html += `<option value='${data[i].id}'>${data[i].creatorName}</option>`;
                }
            }
            $(parentName).find("select[name='" + htmltarget + "']").html(html);
            form.render('select');
        }
    });
</script>